package cn.caipengbo.helloandroid;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.SeekBar;

public class ProgressActivity extends AppCompatActivity {
    private LinearLayout linearLayout;
    private ProgressBar progressBar2;
    private SeekBar seekBar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_progress);
        linearLayout = (LinearLayout) findViewById(R.id.progressBar1);
        progressBar2 = (ProgressBar) findViewById(R.id.progressBar2);
        seekBar = (SeekBar) findViewById(R.id.seekBar1);
        // SeekBar Listener
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                Log.d("改变", "onProgressChanged: ");
                progressBar2.setProgress(progress);
                if (progressBar2.getProgress() == progressBar2.getMax()) {
                    linearLayout.setVisibility(View.INVISIBLE);
                   // linearLayout.setVisibility(View.GONE);
                } else {
                    linearLayout.setVisibility(View.VISIBLE);
                }
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                Log.d("开始点击bar", "onStartTrackingTouch: ");
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                Log.d("松开bar", "onStopTrackingTouch: ");
            }
        });
    }

    public void startProgressBar(View view) {

    }
}
